export default {
    init: function (callback){
        const AK = 'AIzaSyDutiSZXVDDpVoLnvFQnkKKZHfgg0Akbu4'
        const BMap_URL = `https://maps.googleapis.com/maps/api/js?key=${AK}&sensor=false&callback=initializek`
        return new Promise((resolve, reject) => {
            // 插入script脚本
            let scriptNode = document.createElement('script');
            scriptNode.setAttribute('type', 'text/javascript');
            scriptNode.setAttribute('src', BMap_URL);
            document.body.appendChild(scriptNode);
            // 谷歌地图异步加载回调处理
            window.initializek = function () {
                resolve(true);
            };
        });
    }
}